﻿using project.B12.ViewModels;
using System.Windows;
using System.Windows.Controls;

namespace project.B12.Views
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class LoginView : UserControl
    {
        public LoginView()
        {
            InitializeComponent();
        }

        private void txtUserName_Loaded(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(txtUserName.Text))
            {
                txtUserName.Focus();
                txtUserName.SelectionStart = txtUserName.Text.Length;//首次加载时，用户名输入框光标置于尾部
            }
        }

        private void passwordBox_Loaded(object sender, RoutedEventArgs e)
        {
            if (!string.IsNullOrEmpty(txtUserName.Text))
            {
                (sender as PasswordBox).Focus();
            }
        }
    }
}
